package com.hospital.controller;

import com.hospital.entity.User;
import com.hospital.vo.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author fxy
 * @date 2022/9/1
 */
@RestController
@RequestMapping("/api/usersession/")
public class UserSessionController {
    //获取seesion中的用户对象
    @GetMapping("getuser.do")
    public R getSeesion(HttpServletRequest request){
        User user = (User) request.getSession().getAttribute("user");
        System.out.println(user);
        return R.ok(user);
    }
}
